#include "log/log.h"
#include "app_buffer.h"

int main(int argc, char const *argv[])
{
    /**
     * 创建buffer的size12
     * 写1：abcd     abcd           0
     * 写2：efghi    abcdefghi      0
     * 读1：abcd     abcdefghi      4
     * 写3：jklmno   mnodefghijkl   4
     * 读2：efghi    mnodefghijkl   9
     * 读3：jklmno   mnodefghijkl   3
     */
    Buffer *buffer = app_buffer_init(12);

    app_buffer_write(buffer,"abcd",4);

    app_buffer_write(buffer,"efghi",5);

    char buff1[4];
    app_buffer_read(buffer,buff1,4);
log_info("buff1:%s",buff1);
    app_buffer_write(buffer,"jklmno",6);

    char buff2[5];
    app_buffer_read(buffer,buff2,5);
    log_debug("buff1==============%s",buff1);

 log_info("buff2:%s",buff2);
    char buff3[6];
    app_buffer_read(buffer,buff3,6);
    log_info("buff3:%s",buff3);
    log_debug("buff1==============%s",buff1);

    app_buffer_free(buffer);

    return 0;
}
